<?php
session_start();
require "./functions/dbConnections.php";
require "./functions/SQLFunctions.php";
if (isset($_POST["btnLogin"])) {
    $user = $_POST["name"];
    $pass = $_POST["pass"];
    $pass = md5($pass);
    $check = CheckUser($user, $pass);
    $u = mysql_num_rows($check);
    if ($u == 1) {
        $row_user = mysql_fetch_array($check);
        $_SESSION["users_id"] = $row_user['user_id'];
        $_SESSION["name"] = $row_user['name'];
        $_SESSION["password"] = $row_user['password'];
        $_SESSION["email"] = $row_user['email'];
        $_SESSION["group_id"] = $row_user['group_id'];
}
}
?>
<html>
	<head>
		<meta charset="utf-8">
		<title>Văn Phòng Luật Sư Đức Thịnh</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/cpstyle.css" rel="stylesheet" type="text/css" />
		<link href="css/typography.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
		<script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
		<script type="text/javascript" src="js/ckfinder/ckfinder.js"></script>
		<!--ket thuc nut chon file-->
		<link rel="stylesheet" href="css/jquery-ui.css">
		<script src="js/jquery-ui.js"></script>
		<link rel="stylesheet" href="/resources/demos/style.css">
		<!--chÃ¨n calendar-->
		<script>
			$(function() {
				$("#datepicker").datepicker();
			});
			$(function() {
				$("#dob").datepicker();
			});
			$(function() {
				$("#DateSigned").datepicker();
			});
		</script>
		<!--/calendar-->
		<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700&subset=latin,vietnamese' rel='stylesheet' type='text/css'>
	</head>
	<body>
		<div id="container">
			<?php
                $p = $_GET["p"];
                switch($p) {
                    case 'addnews' :
                        require './pages/news/addnews.php';
                        break;
                    case 'editnews' :
                        require './pages/news/editnews.php';
                        break;
                    case 'deletenews' :
                        require './pages/news/deletenews.php';
                        break;
                    case 'newslistcp' :
                        require './pages/news/newslistcp.php';
                        break;
                    case 'contactslist' :
                        require './pages/contact/contactslist.php';
                        break;
                    case 'linklist' :
                        require './pages/link/linklist.php';
                        break;
                    case 'addlink' :
                        require './pages/link/addlink.php';
                        break;
                    case 'editlink' :
                        require './pages/link/editlink.php';
                        break;
                    case 'employeelist' :
                        require './pages/employee/employeelist.php';
                        break;
                    case 'addemployee' :
                        require './pages/employee/addemployee.php';
                        break;
                    case 'editemployee' :
                        require './pages/employee/editemployee.php';
                        break;
                    case 'deleteemployee' :
                        require './pages/employee/deleteemployee.php';
                        break;
                    case 'recruitmentlist' :
                        require './pages/recruitment/recruitmentlist.php';
                        break;
                    case 'addrecruitment' :
                        require './pages/recruitment/addrecruitment.php';
                        break;
                    case 'editrecruitment' :
                        require './pages/recruitment/editrecruitment.php';
                        break;
                    case 'userlist' :
                        require './pages/users/userlist.php';
                        break;
                    case 'adduser' :
                        require './pages/users/adduser.php';
                        break;
                    case 'edituser' :
                        require './pages/users/edituser.php';
                        break;
                    case 'deleteuser' :
                        require './pages/users/deleteuser.php';
                        break;
                    case 'informationlist' :
                        require './pages/information/informationlist.php';
                        break;
                    case 'addinformation' :
                        require './pages/information/addinformation.php';
                        break;
                    case 'editinformation' :
                        require './pages/information/editinformation.php';
                        break;
                    case 'deleteinformation' :
                        require './pages/information/deleteinformation.php';
                        break;
                    case 'logincp' :
                        require './pages/logincp.php';
                        break;
                    case 'cpanel' :
                        require './pages/cpanel.php';
                        break;
                    default :
                        require './pages/cpanel.php';
                }
            ?>
		</div>
	</body>
</html>
